<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"/>
	<title>demo1</title>
	<meta name="keywords" content=""/>
	<meta name="description" content=""/>
	<meta name="viewport" content="width=device-width"/>
	<link rel="shortcut icon" href="img/touchicon.png"/>
	<link rel="stylesheet" href=""/>
	<style type="text/css">
		#searchbox{position:relative;}
		#searchbox label{position:absolute;left:20px;top:50%;margin-top:-.6em;color:#aaa;}
		#searchbox #UserName{width:400px;height:40px;font-size:20px;}
	</style>
</head>
<body>
	<div id="searchbox">
		<label for="UserName" id="labelname">邮箱账号或手机号</label>
		<input type="text" value="" id="UserName">
	</div>
	<script>
		var UserName = document.getElementById('UserName');
		var labelname = document.getElementById('labelname');
		UserName.onkeyup = function(){
			console.log(UserName.value);
			console.log(typeof UserName.value);
			if (UserName.value!='') {
				labelname.innerText = '';
			}else {
				labelname.innerText = '邮箱账号或手机号';
			}
		}
	</script>
</body>
</html>